//
//  FilePathCollectionViewCell.m
//  SBooks
//
//  Created by shansander on 2016/11/16.
//  Copyright © 2016年 shansander. All rights reserved.
//

#import "FilePathCollectionViewCell.h"
#import "AppMacro.h"
#import "AppCustom.h"

@implementation FilePathCollectionViewCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    
//    self.theBgView.layer.cornerRadius = 5.0f;
    
    self.theBgView.backgroundColor = [UIColor clearColor];
    
    [self setBackgroundColor:[UIColor clearColor]];
    
//    self.theBgView.layer.shadowColor = [UIColor blackColor].CGColor;
//    self.theBgView.layer.shadowOffset = CGSizeMake(4, 4);
//    self.theBgView.layer.shadowRadius = 4.0f;
//    self.theBgView.layer.shadowOpacity = 0.5f;
    
    [self setSelectionStyle:UITableViewCellSelectionStyleNone];
}

- (void)displayCollectionView:(NSString *)fileName
{
    NSString * dirctionPath = [AppCustom getSavedFileDirctionPath];
    NSString * filePath = [dirctionPath stringByAppendingPathComponent:fileName];
    NSFileManager * fileManager = [NSFileManager defaultManager];
    
    NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:filePath error:nil];
    NSNumber * fileSize = fileAttributes[NSFileSize];
    _file_size = fileSize;
    
    self.theFileSizeLabel.text = [AppCustom CalculatesFileSize:fileSize];
    
    NSDate * fileCreateTime = fileAttributes[NSFileCreationDate];
    
    self.theFileCreateTimeLabel.text = [AppCustom getCreateTimeString:fileCreateTime];

    self.theFileNameLabel.text = fileName;
    [self.theFileImageView loadFileName:fileName];
}

@end
